import axios from '@/api/fetch';
//import * as types from './types';
import SERVER from '@/api/server';

//特殊配件管理费率维护-主机厂

//特殊配件管理费率维护-主页面查询
// export const getListByPage = params => axios.post(`${SERVER.CLAIMFAC}/rPSpMngRate/getListByPage`,  params );
export const getListByPage = params => axios.post(`${SERVER.CLAIMFAC}/rpManageRate/getListByPage`,  params );

//新增的保存
export const newSave = params => axios.post(`${SERVER.CLAIMFAC}/rPSpMngRate/saveOne`,  params );
export const addRpManageRate = params => axios.post(`${SERVER.CLAIMFAC}/rpManageRate/addRpManageRate`,  params );

//批量启动
export const piliangqiyong = data => axios.post(`${SERVER.CLAIMFAC}/rpManageRate/updateEnableByIds`,  null ,{params : data} );
//批量停用
export const piliangtingyong = data => axios.post(`${SERVER.CLAIMFAC}/rpManageRate/updateEnableByIds`,  null ,{params : data} );
//getModelList
//车型
export const getModelList = data => axios.post(`${SERVER.CLAIMFAC}/rpManageRate/getModelList`);

//Excel导出
// export const excelExport = params => axios.get(`${SERVER.CLAIMFAC}/rPSpMngRate/getListForExport`, params);
// export const excelExport = params => axios.post(`${SERVER.CLAIMFAC}/rPSpMngRate/getListForExport`,  params );

//通过ID查
// export const selectById = params => axios.get(`${SERVER.CLAIMFAC}/rPSpMngRate/selectById/${params.id}`);
export const selectById = params => axios.get(`${SERVER.CLAIMFAC}/rpManageRate//selectById/${params.id}`);

export const excelExport = params => {
  return axios({
    url:`${SERVER.CLAIMFAC}/rPSpMngRate/getListForExport`,
    method: 'get',
    params: params,
    responseType: 'blob'
  });
};
//一般车辆配件类型保修期编辑弹窗的保存
// export const editSave = params => axios.post(`${SERVER.CLAIMFAC}/rPSpMngRate/updateByPtId`,  params );
export const editSave = params => axios.post(`${SERVER.CLAIMFAC}/rpManageRate/updateByMrId`,  params );

//导出模版
export const downloadModel = params => {
  const url = `${SERVER.CLAIMFAC}/rPSpMngRate/exportModel`;
  return axios({
    url,
    method: 'post',
    responseType: 'blob'
  });
};
//导出 http://localhost:4907/rpManageRate/getListForExport
export const getListForExport = params => axios.post(`${SERVER.CLAIMFAC}/rpManageRate/getListForExport`, params, {
  responseType: 'blob'
});
//下载中心导出
export const exporturl = params => axios.post(`/api/cmscloud.excel/downloadExcel/exportExcel/${params.CODE}`, params);
//获取配件
export const getPartList = params =>
  axios.get(`${SERVER.CLAIMFAC}/const/getPartList`, {
    params
  });
